<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>//由协议，域名，端口号，参数四个部分组成
        //location,url="http://www.google.com:8009?name=admin&password=admin"，默认端口号是80.
        //1.assign(载入) 2.reload(重新载入) 3.replace(替换)
        //10秒钟之后打开学校主页 
        setTimeout(openMain,1000);
        function openMain(){
            window.location.assign("http://www.njpi.edu.cn")
        }
        alert("打开学校网站");
        //2.attribute
        //1.hash(哈希表)
        //2.host(主机)
        //3.hostname(主机名)
        //4.href(url)
        //5.pathname(路径)
        //6.port(端口号)
        //7.protocol(协议)
        location.href="http://www.njpi.edu.cn"
        console.log(location.hash);
        console.log(location.host);
        console.log(location.hostname);
        console.log(location.pathname);
        console.log(location.port);
        console.log(location.protocol);
    </script>
</body>
</html>